package com.wangzhixuan.apiController;



import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.wangzhixuan.commons.base.ApiBaseController;
import com.wangzhixuan.commons.constant.ApiCode;
import com.wangzhixuan.model.Version;
import com.wangzhixuan.service.IVersionService;


/**
 * @description：用户管理
 * @author：zhixuan.wang
 * @date：2015/10/1 14:51
 */
//@CrossOrigin(origins = "*")当前版本1.7 会报错，原因版本太低 http://spring.io/guides/gs/rest-service-cors/
@Controller
@RequestMapping("/api")
public class VersionUpdateApiController extends ApiBaseController {
	
	@Autowired
	private IVersionService versionService;
	
	@RequestMapping("/version/update")
    @ResponseBody
    public Object updateVsersion() {
		Version version = versionService.selectById(1);
		String vContent = version.getVContent();
		String version2 = version.getVersion();
		String vUrl = version.getVUrl();
		String vNumber = version.getVNumber();
		Map<String,Object> retMap = new HashMap<String,Object>();
		retMap.put("version", version2);
		retMap.put("vContent", vContent);
		retMap.put("vUrl", vUrl);
		retMap.put("vNumber", vNumber);
        return renderSuccess(ApiCode.CODE_200, "成功",retMap);
    }
	
}
